<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // set 存放的是不重复的value
        let set1 = new Set([1,1,5,8,8]);
        console.log(set1)
        // size容器的长度
        // 向容器中添加值
        set1.add('yangongzi');
        console.log(set1);
        // clear清空
        /* set1.clear();
        console.log(set1); */
        set1.delete('yangongzi');
        console.log(set1);
        // 将容器中的数值变为{1 => 1, 5 => 5, 8 => 8}
        console.log(set1.entries());
        // let set2 = new Set();
        set1.forEach((key,value)=>{
            console.log(key,value);
        })
        // 在set1中有该值吗，有true  没有false
        console.log(set1.has(1));
        
        console.log(set1.keys());
        console.log(set1.values());

        // set主要应用在数组去重
        // 总结数组去重8种

    </script>
</body>
</html>